<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./08.allSettled静态方法.js"></script>
</head>

<body>
    <script>
        /* const p1 = new myPromise((resolve, reject) => {
            console.log("prmise同步代码");
            setTimeout(() => {
                // resolve("success");
                reject("fail");
            }, 1000)
        });

        const p2 = p1.finally(() => {
            // return 123;
            return new myPromise((resolve, reject) => {
                // resolve(123);
                reject(123);
            })
        })

        console.log(p2); */


        /* const p1 = myPromise.reject(new myPromise((resolve, reject) => {
            resolve(123);
            // reject(123);
        }));
        console.log(p1); */



        const p1 = new myPromise((resolve, reject) => {
            setTimeout(() => {
                resolve("success");
                // reject("fail");
            }, 1000)
        });

        const p2 = new myPromise((resolve, reject) => {
            setTimeout(() => {
                resolve("success");
                // reject("fail");
            }, 1000)
        });
        const p3 = new myPromise((resolve, reject) => {
            setTimeout(() => {
                // resolve("success");
                reject("fail");
            }, 1000)
        });

        const p4 = myPromise.allSettled([p1, p2, p3]);
        console.log(p4);
    </script>
</body>

</html>